import request from '@/utils/request.js'
import axios from 'axios'
export function getWeather(query) {
  return axios // 填自己的KEY
    .get(`https://free-api.heweather.com/v5/weather?city=${query}&key=填自己的KEY`)
    .then(resolve => {
      let { data } = resolve
      return data.status === 'ok' ? data : null
    })
}

export function getArticleList(query) {
  return request({
    url: 'api/articleList',
    method: 'get',
    params: query
  })
}
export function submitComment(query) { // 提交评论
  return request({
    url: 'api/articleList/comment',
    method: 'post',
    data: query
  })
}
export function queryComment(query) { // 查询评论
  return request({
    url: 'api/articleList/comment/' + query,
    method: 'get',
  })
}
export function getCaptchaImage(query) { // 获取验证码图片
  return request({
    url: 'api/captchaImage',
    method: 'get',
  })
}
export function upload(data) { // 获取验证码图片
  return request({
    url: 'api/uploadFile',
    method: 'post',
    data
  })
}
export function getHomeBackground(data) { // 获取主页背景图
  return request({
    url: 'api/home/background',
    method: 'get',
  })
}

